Skip to content

Feat/signer two phase commit impl #6319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from

Conversation

jferrant
Copy link
Contributor

@jferrant jferrant commented Jul 21, 2025

Closes #6099

@jferrant jferrant requested review from a team as code owners July 21, 2025 21:59
@aldur aldur linked an issue Jul 22, 2025 that may be closed by this pull request
hstove
hstove previously approved these changes Jul 31, 2025
Copy link
Contributor

@hstove hstove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just a few nits. I found your logic very easy to follow

Signed-off-by: Jacinta Ferrant <[email protected]>
@jferrant jferrant force-pushed the feat/signer-two-phase-commit-impl branch from bd04283 to e304a48 Compare August 1, 2025 20:48
@jferrant jferrant force-pushed the feat/signer-two-phase-commit-impl branch from d46d4ec to 0375c72 Compare August 5, 2025 20:13
@jferrant jferrant requested a review from hstove August 5, 2025 21:22
@jferrant jferrant requested a review from obycode August 5, 2025 21:22
@jferrant jferrant assigned jferrant and unassigned jcnelson and kantai Aug 5, 2025
@jferrant jferrant requested review from jcnelson and kantai August 5, 2025 21:22
hstove
hstove previously approved these changes Aug 5, 2025
Copy link
Contributor

@hstove hstove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM! Just one tiny nit about some debug logs

hstove
hstove previously approved these changes Aug 5, 2025
@jferrant jferrant requested a review from fdefelici August 7, 2025 21:51
@jferrant jferrant requested a review from kantai August 16, 2025 03:22

/// Used by get_block_pre_committers
static CREATE_BLOCK_PRE_COMMITS_BY_SIGHASH_INDEX: &str = r#"
CREATE INDEX idx_block_pre_commits_by_sighash ON block_pre_commits(signer_signature_hash);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this index is really needed (and could be removed to save disk space).

Looking at our queries, they are already covered by the composite index created by the PRIMARY KEY (signer_signature_hash, signer_addr).

Since signer_signature_hash is the leftmost column of the primary key, it efficiently supports lookups like those in get_block_pre_committers(..) without requiring an extra index.

Did you find a scenario where the extra index might actually provide a benefit?

Comment on lines +1007 to +1016
// Make sure the sender is part of our signing set
let is_valid_sender = self.signer_addresses.iter().any(|addr| {
// it only matters that the address hash bytes match
stacker_address.bytes() == addr.bytes()
});

if !is_valid_sender {
debug!("{self}: Received pre-commit message from an unknown sender {stacker_address:?}. Will not store.");
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sanity check:
Could this kind of control be applied to any message a Signer receives from another Signer?
If it makes sense, we might consider generalizing it by moving it into handle_event_match(..).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Signer State Agreement: Two Phase Commit
5 participants